﻿@model TDT.Land.Models.LogOnModel
@{
    ViewBag.Title = "LoginView";
}

@section Header{
    <link href="../../Content/adminLogon.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">
    $(document).ready(function () {
        setMaginTop();
    });

    $(window).resize(function () {
        setMaginTop();
    });

    function setMaginTop() {
        var popMargTop = ($(window).height() - $("div.divlogin").height()) / 2;


        $("div.divlogin").css({
            "margin-top":popMargTop
        
        });
    }

    function LogOn() {

        showLoading();
        var itemObj = getInfoLogOn();
        if (itemObj == null) {
            return;
        }
        $.post("/Admin/LoginAction", itemObj, function (data) {
            var msg = data.Msg;
            if (msg == "") {
                location.href = "/Admin/Index";
            }
            else {
                cusAlert(msg);
                hideLoading();
            }
        });
    }
    function getInfoLogOn() {
        var uid = $("#UserName").val();
        var pwd = $("#Password").val();

        return { UserName: uid, Password: pwd };
    }
  
</script>

}

<center>
    <div class="divlogin">
    <div class="Clearfix">
        <img src="../../Content/Image/admin/logo_top.png" class="imgInfo" /> 
        <div class="loginInfo">Welcome to Admin Site</div>
    </div>
    <div>
        @using (@Html.BeginForm("LoginAction", "Admin", FormMethod.Post))
{
    <table cellpadding="0" cellspacing="0" class="tb_login">
        <tr>
            <th>
                @Html.Label(LogOnModel.FieldName.UserName.Translate())
            </th>
            <td>
                @Html.TextBoxFor(m => m.UserName)
            </td>
        </tr>
        <tr>
            <th>
                @Html.Label(LogOnModel.FieldName.Password.Translate())
            </th>
            <td>
                @Html.PasswordFor(m => m.Password)
            </td>
        </tr>
        
    </table>
         <div>
            <a class="btn" onclick="LogOn()">Logon</a>
         </div>
}
</div>
    </div>
</center>

